package novel.web.service;

import novel.spider.entitys.Novel;
import novel.web.mapper.NovelMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Kau on 2016/11/28.
 */
@Service
public class NovelServiceImpl implements NovelService {
    @Resource
    private NovelMapper mapper;
    @Override
    public List<Novel> getsNovelByKeyword(String keyword) {
        keyword = "%" + keyword + "%";
        return mapper.getsNovelByKeyword(keyword);
    }

    @Override
    public List<Novel> getsNovelByKeyword(String keyword, int platformId) {
        Map<String, String> map = new HashMap<>();
        map.put("keyword","%" + keyword + "%");
        map.put("platformId", platformId + "");
        return mapper.getsNovelByKeyword2(map);
    }
}
